package com.ivi.car.bean.carstate;

import java.io.Serializable;

/**
 * Copyright
 * author chengxp
 * date 2018/3/6
 * describe 汽车某个部件的状态
 * history
 */

public class CarPartState implements Serializable {
    private static final long serialVersionUID = 1L;
    private String name;
    private int totalTime;
    private int totalMileage;
    private int time;
    private int mileage;
    //0-良好，1-过期未保养 2，需保养
    private int stateType = 0;

    public CarPartState(String name, int totalTime, int totalMileage, int time, int mileage) {
        this.name = name;
        this.totalTime = totalTime;
        this.totalMileage = totalMileage;
        this.time = time;
        this.mileage = mileage;
        if (totalTime <= time && totalMileage <= mileage) {
            stateType = 2;
        } else if (totalTime <= time || totalMileage <= mileage) {
            stateType = 1;
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getTotalTime() {
        return totalTime;
    }

    public void setTotalTime(int totalTime) {
        this.totalTime = totalTime;
    }

    public int getTotalMileage() {
        return totalMileage;
    }

    public void setTotalMileage(int totalMileage) {
        this.totalMileage = totalMileage;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public int getMileage() {
        return mileage;
    }

    public void setMileage(int mileage) {
        this.mileage = mileage;
    }

    public int getStateType() {
        return stateType;
    }

    @Override
    public String toString() {
        return "CarPartState{" +
                "name='" + name + '\'' +
                ", totalTime=" + totalTime +
                ", totalMileage=" + totalMileage +
                ", time=" + time +
                ", mileage=" + mileage +
                ", stateType=" + stateType +
                '}';
    }
}
